﻿using monsterManager;
using System;
using System.Collections;
using System.Formats.Asn1;
using System.Reflection;

namespace CSharp基础
{
    class Program
    {
        public static void Main(string[] args)
        {
            Pos[] poses = new Pos[4];
            Pos pos = new Pos(Console.WindowWidth / 2, 1);
            poses[0] = pos;
            poses[1] = new Pos(pos.x + 1, pos.y);
            poses[2] = new Pos(pos.x + 2, pos.y);
            poses[3] = new Pos(pos.x + 3, pos.y);     
            foreach (Pos posEach in poses)
            {
                Console.Write(posEach.x);
                Console.Write(posEach.y);
            }
        }

    public struct Pos
    {
        internal int x, y;
        public Pos(int x, int y)
        {
            this.x = x;
            this.y = y;
        }
    }
        }
    
}

namespace monsterManager
{
    class MonsterManager
    {
        internal static Hashtable monsters = new Hashtable();
        public Monster monsterSpawn()
        {
            Monster monster = new Monster();
            monsters.Add(monster.Id, monster);
            return monster;
        }
        public bool monsterRemove(int id)
        {
            monsters.Remove(id);
            return true;
        }
    }
    class Monster
    {
        internal int Id;
        public int HP;
        public int value
        {
            get;
            set;
        }
        public Monster()
        {
            Random r = new Random();
            while (true)
            {
                int id = r.Next(1, 100);
                bool idCrush = false;
                foreach (Monster monster in MonsterManager.monsters)
                {
                    if (monster.Id == id)
                        idCrush = true;
                }
                if (!idCrush)
                {
                    Id = id;
                    break;
                }
            }
        }
    }
    class GameSystem
    {
        Action monsterDeadHandler = null;
        public void monsterDead(Monster monster)
        {
            monsterDeadHandler += moneyIncrease(monster.value);
            monsterDeadHandler += menuFrush();
            monsterDeadHandler += killedIncrease();
            if (monster.HP <= 0)
            {
                monsterDeadHandler.Invoke();
            }


        }

        private Action killedIncrease()
        {
            throw new NotImplementedException();
        }

        private Action menuFrush()
        {
            throw new NotImplementedException();
        }

        private Action moneyIncrease(int money)
        {
            throw new NotImplementedException();
        }
    }
}
